package org.syncsoft.overalt.communication.api;

import java.io.File;
import java.util.Collection;

import org.syncsoft.overalt.domain.community.entity.Community;
import org.syncsoft.overalt.domain.document.entity.Document;
import org.syncsoft.overalt.domain.document.entity.Permission;
import org.syncsoft.overalt.domain.user.entity.User;

/**
 * provides an interface of communication between the client and server
 * 
 * @author tptfc
 *
 */
public interface ICommunication {
	/**
	 * @precondition fileId > 0
	 * 
	 * @param fileID
	 * @return null if not exist the file with this fileId
	 */
	public Collection<Integer> getDocumentFile(int fileID);
	
	/**
	 * 
	 * @param data 
	 * @param description description of the commit
	 * @return id of the new version of file
	 */
	public int addFile(Document document, File file);
	
	/**
	 * @param document
	 * @param file
	 * @param versionDescription
	 * @return
	 */
	
	public int commit(String versionDescription, Document document, File file);
	
	/**
	 * 
	 * @param fileID id of the file
	 */
	
	public void delete(int fileId);
	
	
	/**
	 * @precondition fileId > 0
	 * 
	 * @param fileID
	 * @return
	 */
	public Document getDocument(int fileId);
	
	/**
	 * @precondition communityId must be valid.
	 * 
	 * @param communityId
	 * @return Collection<User>
	 */
	public Collection<User> getCommunityMembers(int communityId);
 
	/**
	 * @precondition userId must be valid.
	 * 
	 * @param userId
	 * @return Collection<Community> 
	 */
	public Collection<Community> getUserCommunities(int userId);
	
	/**
	 * @precondition userId must be valid.
	 * 
	 * @param userId
	 * @return Collection<User>
	 */
	public Collection<User> getUserContacts(int userId);

	/**
	 * @precondition commId > 0
	 * 
	 * @param commId
	 * @return
	 */
	public Collection<Document> getCommunityFiles(int commId);
	
	/**
	 * @precondition userId > 0
	 * @param userId
	 * @return
	 */
	public Collection<Document> getUserFiles(int userId);

	/**
	 * @precondition login != null && password != null
	 * 
	 * @param login
	 * @param password
	 * @return
	 */
	public int getUserInSessionCode();
	
	/**
	 * 
	 * @param code
	 * @return
	 */
	public Permission getPermission(int code);
}
